Precise Interprocedural Dataflow Analysis with Applications to Constant Propagation

نویسندگان

  • Shmuel Sagiv
  • Thomas W. Reps
  • Susan Horwitz
چکیده

This paper concerns inter-procedural dataflow-analysis problems in which the dataflow information at a program point is represented by an environment (i.e., a mapping from symbols to values), and the effect of a program operation is represented by a distributive environment transformer. We present two efficient algorithms that produce precise solutions: an exhaustive algorithm that finds values for all symbols at all program points, and a demand algorithm that finds the value for an individual symbol at a particular program point. Two interesting problems that can be handled by our algorithms are (decidable) variants of the interprocedural constant-propagation problem: copy-constant propagation and linear-constant propagation. The former interprets program statements of the form x := 7 and x := y. The latter also interprets statements of the form x := 5 * y + 17. Experimental results on C programs have shown that Although solving constant-propagation problems precisely (i.e., finding the meet-over-allvalid-paths solution, rather than the meet-over-all-paths solution) resulted in a slowdown by a factor ranging from 2.2 to 4.5, the precise algorithm found additional constants in 7 of 38 test programs. In contrast to previous results for numeric Fortran programs, linear-constant propagation found more constants than copy-constant propagation in 6 of 38 test programs. The demand algorithm, when used to demand values for all uses of scalar integer variables, was faster than the exhaustive algorithm by a factor ranging from 1.14 to about 6. * Corresponding author. ’ This work was supported in part by a David and Lucile Packard Fellowship for Science and Engineering, by the National Science Foundation under granta CCR-8958530 and CCR-9100424, by the Defense Advanced Research Projects Agency under ARPA Order No. 8856 (monitored by the Office of Naval Research under contract N00014-92-J-1937), and by a grant from Xerox Corporate Research. Part of this work was done while the authors were visiting the University of Copenhagen. A preliminary version of this paper appeared in Proc. of FASE 95: Colloquium on Formal Approaches in Software Engineering, (Aarhus, Denmark, May 22-26, 1995) [27]. z Current address: Department of Computer Science, The University of Chicago, 1100 East 58th Street, Chicago, IL 60637, USA. 0304-3975/96/$15.00 @ 1996-Elsevier Science B.V. All rights reserved PZI SO304-3975(96)00072-2 132 M. Sagiv et al. I Theoretical Computer Science 167 (1996) 131-170

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Precise Interprocedural Dataaow Analysis with Applications to Constant Propagation 1

This paper concerns interprocedural dataaow-analysis problems in which the dataaow information at a program point is represented by an environment (i.e., a mapping from symbols to values), and the eeect of a program operation is represented by a distributive environment transformer. We present an eecient dynamic-programming algorithm that produces precise solutions. The method is applied to sol...

متن کامل

Faster Algorithms for Algebraic Path Properties in RSMs with Constant Treewidth

Interprocedural analysis is at the heart of numerous applications in programming languages, such as alias analysis, constant propagation, etc. Recursive state machines (RSMs) are standard models for interprocedural analysis. We consider a general framework with RSMs where the transitions are labeled from a semiring, and path properties are algebraic with semiring operations. RSMs with algebraic...

متن کامل

Precise Interprocedural Dataflow Analysis via Graph Reachability ( Extended

This paper shows how to find precise solutions to a large class of interprocedural dataflow-analysis problems in polynomial time. In contrast with intraprocedural dataflow analysis, where “precise” means “meet-over-all-paths”[16], a precise interprocedural dataflow-analysis algorithm must provide the “meet-over-all-valid-paths” solution. (A path is valid if it respects the fact that when a proc...

متن کامل

Interprocedural Dataflow Analysis via Graph Reachability

This paper shows how a large class of interprocedural dataflow-analysis problems can be solved precisely in polynomial time. The only restrictions are that the set of dataflow facts is a finite set, and that the dataflow functions distribute over the confluence operator (either union or intersection). This class of problems includes—but is not limited to—the classical separable problems (also k...

متن کامل

Interprocedural Exception Analysis for C++

C++ Exceptions provide a useful way for dealing with abnormal program behavior, but often lead to irregular interprocedural control flow that complicates compiler optimizations and static analysis. In this paper, we present an interprocedural exception analysis and transformation framework for C++ that captures the control-flow induced by exceptions and transforms it into an exception-free prog...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995